﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace HamcoWcs.DAL.Migrations
{
    public partial class Init : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "alarm_explanation",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ErrorType = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "报警类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Module = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "模块")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Code = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "错误代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Level = table.Column<int>(type: "int", nullable: false, defaultValue: 1, comment: "等级"),
                    AlarmName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "故障名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Summary = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true, defaultValue: "", comment: "描述")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Suggestion = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true, defaultValue: "", comment: "建议")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_alarm_explanation", x => x.Id);
                },
                comment: "故障说明配置表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "base_config",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ConfigKey = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "配置名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConfigValue = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "配置值")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Desc = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true, comment: "配置说明")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_base_config", x => x.Id);
                },
                comment: "基础配置表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "device_error_log",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PlcName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "PLC名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeviceName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "设备名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ErrorCode = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "异常代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ErrorDetail = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "异常说明")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SetTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "恢复时间"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_device_error_log", x => x.Id);
                },
                comment: "设备异常日志表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "device_error_log_bak",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PlcName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "PLC名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeviceName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "设备名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ErrorCode = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "异常代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ErrorDetail = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "异常说明")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SetTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "恢复时间"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_device_error_log_bak", x => x.Id);
                },
                comment: "设备异常日志备份表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "device_msg_log",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PlcName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "PLC名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeviceName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "设备名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TaskId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "任务号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UnitId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "托盘号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MsgValue = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false, comment: "创建时间")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Direction = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "方向：rend/recv")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_device_msg_log", x => x.Id);
                },
                comment: "设备通讯日志")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "device_msg_log_bak",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PlcName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "PLC名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeviceName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "设备名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TaskId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "任务号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UnitId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "托盘号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MsgValue = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false, comment: "创建时间")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_device_msg_log_bak", x => x.Id);
                },
                comment: "设备消息日志备份表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "device_msg_queue",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PlcName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "PLC名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeviceName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "设备名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StartPoint = table.Column<int>(type: "int", nullable: false, comment: "DB偏移量"),
                    MsgValue = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "消息内容，bytes转换为string")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_device_msg_queue", x => x.Id);
                },
                comment: "托盘输/堆垛机送线消息队列")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "edge_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    EdgeName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "起点node-终点node")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FromNode = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "起点wmsnode")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ToNode = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "终点wmsnode")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExcutePlc = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "执行的PLC名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EdgeType = table.Column<int>(type: "int", nullable: false, comment: "段类型，功能区分用")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_edge_info", x => x.Id);
                },
                comment: "路径模块-段信息")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "lcd_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    StationName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "Lcd对应的输送机设备号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LcdName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Lcd名")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_lcd_info", x => x.Id);
                },
                comment: "Lcd信息表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "led_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    LedIp = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led Ip地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StationName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led对应的输送机设备号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LedName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led名")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_led_info", x => x.Id);
                },
                comment: "Led信息表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "led_msg_queue",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    LedIp = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led Ip地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StationName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led对应的输送机设备号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LedName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LedMsg = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "创建时间")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SendFlag = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "已发未发标记"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_led_msg_queue", x => x.Id);
                },
                comment: "Led消息队列")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "login_log",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UserName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "用户名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LoginIP = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "登陆IP")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_login_log", x => x.Id);
                },
                comment: "前端登录日志")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "mail_msg_queues",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Msg = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "消息内容")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_mail_msg_queues", x => x.Id);
                },
                comment: "邮件消息队列")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "main_task",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Sender = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "发送方：WMS\\WCS")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TaskId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "任务号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FromLoc = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "起点")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ToLoc = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "终点")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UnitId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "条码号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Priority = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "优先级")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Extend = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "扩展")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "异常区分")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MainTaskType = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "主任务类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ActiveSubTaskId = table.Column<int>(type: "int", nullable: false, comment: "正在执行的子任务"),
                    TotalSubTaskNum = table.Column<int>(type: "int", nullable: false, comment: "子任务总数"),
                    TaskStatus = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "任务状态")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_main_task", x => x.Id);
                },
                comment: "主任务表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "main_task_bak",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Sender = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "发送方：WMS\\WCS")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TaskId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "任务号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FromLoc = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "起点")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ToLoc = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "终点")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UnitId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "条码号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Priority = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "优先级")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Extend = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "扩展")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "异常区分")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MainTaskType = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "主任务类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ActiveSubTaskId = table.Column<int>(type: "int", nullable: false, comment: "正在执行的子任务"),
                    TotalSubTaskNum = table.Column<int>(type: "int", nullable: false, comment: "子任务总数"),
                    TaskStatus = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "任务状态")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_main_task_bak", x => x.Id);
                },
                comment: "主任务备份表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "menu_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ParentId = table.Column<long>(type: "bigint", nullable: false, comment: "父节点ID"),
                    MenuSort = table.Column<int>(type: "int", nullable: false, comment: "节点排序"),
                    MenuName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "菜单名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MenuUrl = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "菜单路由")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MenuIcon = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "菜单图标")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MenuType = table.Column<int>(type: "int", nullable: false, comment: "节点排序"),
                    Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否有效")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_menu_info", x => x.Id);
                },
                comment: "菜单表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "mes_msg_log",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Sender = table.Column<int>(type: "int", nullable: false, comment: "发送方"),
                    TransactionId = table.Column<string>(type: "varchar(45)", maxLength: 45, nullable: false, comment: "时间戳")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Content = table.Column<string>(type: "longtext", maxLength: 100, nullable: false, comment: "数据内容")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Return = table.Column<string>(type: "longtext", maxLength: 100, nullable: false, comment: "返回的数据")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EventName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, defaultValue: "", comment: "主题")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "消息状态"),
                    BusinessType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "业务类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RequestType = table.Column<int>(type: "int", nullable: false, comment: "请求类型"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_mes_msg_log", x => x.Id);
                },
                comment: "Mes消息队列")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "mes_msg_queue",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Sender = table.Column<int>(type: "int", nullable: false, comment: "发送方"),
                    TransactionId = table.Column<string>(type: "varchar(45)", maxLength: 45, nullable: false, comment: "时间戳")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Content = table.Column<string>(type: "longtext", maxLength: 100, nullable: false, comment: "数据内容")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Return = table.Column<string>(type: "longtext", maxLength: 100, nullable: false, comment: "返回的数据")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EventName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, defaultValue: "", comment: "主题")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "消息状态"),
                    BusinessType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "业务类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RequestType = table.Column<int>(type: "int", nullable: false, comment: "请求类型"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_mes_msg_queue", x => x.Id);
                },
                comment: "Mes消息队列")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "mes_msg_queue_dto",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Sender = table.Column<int>(type: "int", nullable: false),
                    TransactionId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Content = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Return = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EventName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Status = table.Column<int>(type: "int", nullable: false),
                    BusinessType = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RequestType = table.Column<int>(type: "int", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_mes_msg_queue_dto", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "monitor_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Type = table.Column<int>(type: "int", nullable: false, comment: "监控类型"),
                    Name = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "设备名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StartPoint = table.Column<int>(type: "int", nullable: false, comment: "偏移量"),
                    Length = table.Column<int>(type: "int", nullable: false, comment: "长度"),
                    PlcName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "PLC名")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_monitor_info", x => x.Id);
                },
                comment: "监控信息表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "msg_info_group_config",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    GroupName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "类型英文名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    GroupDescription = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "类型中文名")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_msg_info_group_config", x => x.Id);
                },
                comment: "消息类型中英对照表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "node_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    NodeName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "点位名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeviceType = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "设备类型:Con、Srm、Agv")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PlcName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "Plc名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WmsNodeName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "Wms点位名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    NextNode = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true, comment: "下一节点名：多节点用;分开")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExcuteSrm = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true, comment: "堆垛机名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Bay = table.Column<int>(type: "int", nullable: false, comment: "站台列")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_node_info", x => x.Id);
                },
                comment: "路径模块-点信息")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "operation_log",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UserName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "用户名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UnitId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "条码号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeviceName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "设备名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "具体操作")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_operation_log", x => x.Id);
                },
                comment: "操作日志表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "path_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PathName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "起点wmsnode-终点wmsnode")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FromWmsNode = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "起点wmsnode")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ToWmsNode = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "终点wmsnode")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PathValue = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "路径节点明细，用‘-’连接")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PathType = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "路径类型")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_path_info", x => x.Id);
                },
                comment: "路径模块-路径表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "pcon_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PconName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "输送机名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MachineName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValue: "", comment: "机器名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PortName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValue: "", comment: "端口名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PlcName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "PLC名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PconType = table.Column<int>(type: "int", nullable: false, comment: "输送机类型：0非交互点，1交互点,2port_in,3port_out,4buffer位"),
                    SendStartPoint = table.Column<int>(type: "int", nullable: false, comment: "发送DB偏移量"),
                    RecvStartPoint = table.Column<int>(type: "int", nullable: false, comment: "接收DB偏移量")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_pcon_info", x => x.Id);
                },
                comment: "输送机信息表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "playback_log",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PlayDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "发生时间"),
                    Module = table.Column<string>(type: "varchar(45)", maxLength: 45, nullable: true, comment: "模块")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Content = table.Column<string>(type: "longtext", maxLength: 100, nullable: true, comment: "当前时段数据")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_playback_log", x => x.Id);
                },
                comment: "回放数据")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "plc_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PlcName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "PLC名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PlcIp = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "PlcIp地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PlcPort = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "Plc端口，socket用")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PlcType = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "PLC类型：srm、con、agv")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MaxBay = table.Column<int>(type: "int", nullable: false, comment: "最大列"),
                    MachineName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValue: "", comment: "机器名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PortName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValue: "", comment: "端口名")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_plc_info", x => x.Id);
                },
                comment: "Plc信息表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "raster",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(type: "varchar(45)", maxLength: 45, nullable: false, comment: "光栅名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ErrorOffset = table.Column<string>(type: "varchar(45)", maxLength: 45, nullable: false, comment: "异常DB偏移量")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    BypassReadOffset = table.Column<string>(type: "varchar(45)", maxLength: 45, nullable: false, comment: "BypassDB读取偏移量，DB103")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    BypassWriteOffset = table.Column<string>(type: "varchar(45)", maxLength: 45, nullable: false, comment: "BypassDB写入偏移量，Db104")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MachinePosition = table.Column<string>(type: "varchar(45)", maxLength: 45, nullable: true, defaultValue: "", comment: "设备位置")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_raster", x => x.Id);
                },
                comment: "安全光栅配置表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "role_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    RoleName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "角色名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "简述")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Menus = table.Column<string>(type: "varchar(2555)", maxLength: 2555, nullable: false, comment: "角色列表")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否启用")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_role_info", x => x.Id);
                },
                comment: "角色表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "role_menu",
                columns: table => new
                {
                    RoleId = table.Column<long>(type: "bigint", nullable: false, comment: "角色Id"),
                    MenuId = table.Column<long>(type: "bigint", nullable: false, comment: "菜单Id")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_role_menu", x => new { x.RoleId, x.MenuId });
                },
                comment: "角色-菜单表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "system_error_log",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Log = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "日志内容")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_system_error_log", x => x.Id);
                },
                comment: "系统异常表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "task_amount",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    TotalTaskAmount = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "总任务数量")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InboundTaskAmount = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "入库任务数量")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OutboundTaskAmount = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "出库任务数量")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    amount = table.Column<int>(type: "int", nullable: false, comment: "每天任务数量"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_task_amount", x => x.Id);
                },
                comment: "任务统计表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "user_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UserNo = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "账户")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UserName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "账户名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Password = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "密码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RoleId = table.Column<long>(type: "bigint", nullable: false, comment: "角色ID"),
                    Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否启用"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_user_info", x => x.Id);
                },
                comment: "用户表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "wcs_buffer",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    BufferName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "缓存位名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MachineName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "mes设备名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PortName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "mes port名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UnitId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "托盘号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Status = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "缓存位状态")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_wcs_buffer", x => x.Id);
                },
                comment: "buffer位状态")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "wcs_location",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Row = table.Column<int>(type: "int", nullable: false, comment: "排"),
                    Bay = table.Column<int>(type: "int", nullable: false, comment: "列"),
                    Lev = table.Column<int>(type: "int", nullable: false, comment: "层"),
                    Depth = table.Column<int>(type: "int", nullable: false, defaultValue: 1, comment: "深度"),
                    WmsLocName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "wms货位名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WcsLocName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "wcs货位名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SrmName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "堆垛机名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UnitId = table.Column<string>(type: "varchar(60)", maxLength: 60, nullable: true, comment: "托盘号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LocStatus = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "货位状态，有货、无货、正在入库、正在出库"),
                    IsLock = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否锁定，true-锁定，false-释放"),
                    SrmOccupyFlag = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否占用，true-占用，false-未占用"),
                    BasicShelf = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否为基准货位"),
                    LocType = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "货位类型，SHELF | STATION")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Aisle = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "巷道号 CJSTW100 | CJSTW200")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ZoneName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, defaultValue: "", comment: "Zone名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WcsZone = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, defaultValue: "", comment: "堆垛机双机模式运行划分区域")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TeachInfo = table.Column<string>(type: "json", maxLength: 100, nullable: true, defaultValue: "", comment: "teach数据")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true, defaultValue: "", comment: "备注 时间-用户-内容")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_wcs_location", x => x.Id);
                },
                comment: "wcs货位表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "wcs_run_log",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UnitId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "托盘号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MsgValue = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "消息内容")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_wcs_run_log", x => x.Id);
                },
                comment: "wcs运行日志")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "wcs_run_log_bak",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UnitId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "托盘号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MsgValue = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "消息内容")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_wcs_run_log_bak", x => x.Id);
                },
                comment: "wcs运行日志备份表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "sub_task",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    TaskFrom = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "发送方：WMS\\WCS")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SubTaskId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "子任务Id")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SubTaskType = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "子任务类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UnitId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "条码号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FromLoc = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "起点")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ToLoc = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "终点")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TaskSeq = table.Column<int>(type: "int", nullable: false, comment: "任务序列：1.2.3…"),
                    TaskStatus = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "任务状态")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PlcName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MainTaskId = table.Column<long>(type: "bigint", nullable: true),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sub_task", x => x.Id);
                    table.ForeignKey(
                        name: "FK_sub_task_main_task_MainTaskId",
                        column: x => x.MainTaskId,
                        principalTable: "main_task",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                },
                comment: "子任务表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "sub_task_bak",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    TaskFrom = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "发送方：WMS\\WCS")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SubTaskId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "子任务Id")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SubTaskType = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "子任务类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UnitId = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "条码号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FromLoc = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "起点")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ToLoc = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "终点")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TaskSeq = table.Column<int>(type: "int", nullable: false, comment: "任务序列：1.2.3…"),
                    TaskStatus = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "任务状态")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PlcName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MainTaskId = table.Column<long>(type: "bigint", nullable: true),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sub_task_bak", x => x.Id);
                    table.ForeignKey(
                        name: "FK_sub_task_bak_main_task_bak_MainTaskId",
                        column: x => x.MainTaskId,
                        principalTable: "main_task_bak",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                },
                comment: "子任务备份表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "msg_info_config",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    ConfigKey = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "索引")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConfigValue = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true, comment: "值")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConfigMsgInfoGroup = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConfigGroupId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_msg_info_config", x => x.Id);
                    table.ForeignKey(
                        name: "FK_msg_info_config_msg_info_group_config_ConfigGroupId",
                        column: x => x.ConfigGroupId,
                        principalTable: "msg_info_group_config",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                },
                comment: "消息明细")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "db_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    DbName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "DB名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DbNum = table.Column<int>(type: "int", nullable: false, comment: "S7-DB块，MC-DB偏移量"),
                    DbLength = table.Column<int>(type: "int", nullable: false, comment: "DB块长度"),
                    StartPoint = table.Column<int>(type: "int", nullable: false),
                    PlcInfoId = table.Column<long>(type: "bigint", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_db_info", x => x.Id);
                    table.ForeignKey(
                        name: "FK_db_info_plc_info_PlcInfoId",
                        column: x => x.PlcInfoId,
                        principalTable: "plc_info",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                },
                comment: "DB块信息表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_db_info_PlcInfoId",
                table: "db_info",
                column: "PlcInfoId");

            migrationBuilder.CreateIndex(
                name: "IX_msg_info_config_ConfigGroupId",
                table: "msg_info_config",
                column: "ConfigGroupId");

            migrationBuilder.CreateIndex(
                name: "IX_sub_task_MainTaskId",
                table: "sub_task",
                column: "MainTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_sub_task_bak_MainTaskId",
                table: "sub_task_bak",
                column: "MainTaskId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "alarm_explanation");

            migrationBuilder.DropTable(
                name: "base_config");

            migrationBuilder.DropTable(
                name: "db_info");

            migrationBuilder.DropTable(
                name: "device_error_log");

            migrationBuilder.DropTable(
                name: "device_error_log_bak");

            migrationBuilder.DropTable(
                name: "device_msg_log");

            migrationBuilder.DropTable(
                name: "device_msg_log_bak");

            migrationBuilder.DropTable(
                name: "device_msg_queue");

            migrationBuilder.DropTable(
                name: "edge_info");

            migrationBuilder.DropTable(
                name: "lcd_info");

            migrationBuilder.DropTable(
                name: "led_info");

            migrationBuilder.DropTable(
                name: "led_msg_queue");

            migrationBuilder.DropTable(
                name: "login_log");

            migrationBuilder.DropTable(
                name: "mail_msg_queues");

            migrationBuilder.DropTable(
                name: "menu_info");

            migrationBuilder.DropTable(
                name: "mes_msg_log");

            migrationBuilder.DropTable(
                name: "mes_msg_queue");

            migrationBuilder.DropTable(
                name: "mes_msg_queue_dto");

            migrationBuilder.DropTable(
                name: "monitor_info");

            migrationBuilder.DropTable(
                name: "msg_info_config");

            migrationBuilder.DropTable(
                name: "node_info");

            migrationBuilder.DropTable(
                name: "operation_log");

            migrationBuilder.DropTable(
                name: "path_info");

            migrationBuilder.DropTable(
                name: "pcon_info");

            migrationBuilder.DropTable(
                name: "playback_log");

            migrationBuilder.DropTable(
                name: "raster");

            migrationBuilder.DropTable(
                name: "role_info");

            migrationBuilder.DropTable(
                name: "role_menu");

            migrationBuilder.DropTable(
                name: "sub_task");

            migrationBuilder.DropTable(
                name: "sub_task_bak");

            migrationBuilder.DropTable(
                name: "system_error_log");

            migrationBuilder.DropTable(
                name: "task_amount");

            migrationBuilder.DropTable(
                name: "user_info");

            migrationBuilder.DropTable(
                name: "wcs_buffer");

            migrationBuilder.DropTable(
                name: "wcs_location");

            migrationBuilder.DropTable(
                name: "wcs_run_log");

            migrationBuilder.DropTable(
                name: "wcs_run_log_bak");

            migrationBuilder.DropTable(
                name: "plc_info");

            migrationBuilder.DropTable(
                name: "msg_info_group_config");

            migrationBuilder.DropTable(
                name: "main_task");

            migrationBuilder.DropTable(
                name: "main_task_bak");
        }
    }
}
